


class obj:
    file = ""
    v = []
    f = []
    def __init__(self,file):
        self.file = file
    def load(self):
        f = open(self.file,"r")
        fcontent = f.readlines()
        c = 0
        for line in fcontent:
            l = line.split()
            if i[0]=="v":
                v = []
                vert.append(float(i[1]))
                vert.append(float(i[2]))
                vert.append(float(i[3]))
                self.v[c] = vert
                c +=1
            elif l[0] == "f":
                p1,p2,p3 = int(l[1])-1,int(l[2])-1,int(l[3])-1
                poly1,poly2,poly3 = self.verts[p1],self.verts[p2],self.verts[p3]
                currface = object.face((poly1,poly2,poly3))
                self.faces.append(currface)
        return 1
    
fi = open("cube.obj")
cv = 1
cf = 1
v = {}
f = {}
for i in fi:
    vert=[]
    face=[]
    i = i.split()
    if i[0]=="v":
        vert.append(float(i[1]))
        vert.append(float(i[2]))
        vert.append(float(i[3]))
        #print vert
        v[cv] = vert
        cv +=1
    elif i[0] == "f":
        face.append(v[int(i[1])])
        face.append(v[int(i[2])])
        face.append(v[int(i[3])])
        #print face
        f[cf] = face
        cf +=1
    else:
        pass
for i in range(1,len(f)+1):
    print "new face: %i" %i
    for j in f[i]:
        print j